section
  .row
    .col-md-12
      .card
        .card-header
          h3.card-title
            i.icon.fas.fa-history
            = t('dashboard.timeline.title')

        - if @releases.present?
          .card-body.pb-0
            .timeline
              ruby:
                loop_date = Time.current
              - @releases.each_with_index do |release, i|
                - if i == 0 || (loop_date.to_date != release.created_at.to_date)
                  ruby:
                    loop_date = release.created_at
                  .time-label
                    span.bg-olive
                      = release.created_at.strftime('%Y-%m-%d')

                div
                  i.fab.mt-1 class="#{timeline_app_icon(release.channel.device_type)}"
                  .timeline-item
                    span.time data-toggle="tooltip" data-placement="left" title="#{release.created_at}"
                      i.icon.fas.fa-clock
                      = time_ago_in_words(release.created_at)
                    h3.timeline-header
                      = link_to(release.app_name, friendly_channel_release_path(release.channel, release), class: 'pr-1')
                      = t('dashboard.timeline.upload_release', release_version: release.release_version, build_version: release.build_version)
                    - if release.changelog.present?
                      .timeline-body.pb-1
                        = changelog_format release.text_changelog, class: 'mb-0'
                    - if release.release_type.present? || release.branch.present? || release.short_git_commit.present?
                      .timeline-footer
                        - if release.device_type
                          small.badge
                            = device_name(release.device_type)
                        - if release.release_type
                          small.badge
                            = release.release_type
                        - if release.branch
                          small.badge
                            = release.branch
                        - if release.short_git_commit
                          small.badge
                            = release.short_git_commit

              div
                i.fas.fa-clock
        - else
          .card-body
            = t('dashboard.timeline.not_found')

        - if @releases.total_pages > 1
          .card-footer
            .float-right
              = paginate @releases
